/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author User
 */
@Entity
@Table(name = "CHECKS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Checks.findAll", query = "SELECT c FROM Checks c"),
    @NamedQuery(name = "Checks.findByCheckid", query = "SELECT c FROM Checks c WHERE c.checkid = :checkid"),
    @NamedQuery(name = "Checks.findByDate", query = "SELECT c FROM Checks c WHERE c.date = :date"),
    @NamedQuery(name = "Checks.findByValid", query = "SELECT c FROM Checks c WHERE c.valid = :valid"),
    @NamedQuery(name = "Checks.findByCustomerID", query = "SELECT c FROM Checks c WHERE c.customerId = :customerId")})
public class Checks implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "CHECKID")
    private Integer checkid;
    @Basic(optional = false)
    @Column(name = "Date")
    private String date;
    @Basic(optional = false)
    @Column(name = "VALID")
    private boolean valid;
    @JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "CUSTOMER_ID")
    @ManyToOne(optional = false)
    private Customer customerId;

    public Checks() {
    }

    public Checks(Integer checkid) {
        this.checkid = checkid;
    }

    public Checks(Integer checkid, String date, boolean valid) {
        this.checkid = checkid;
        this.date = date;
        this.valid = valid;
    }

    public Integer getCheckid() {
        return checkid;
    }

    public void setCheckid(Integer checkid) {
        this.checkid = checkid;
    }

    public String getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date.toString();
    }

    public boolean getValid() {
        return valid;
    }

    public void setValid(boolean valid) {
        this.valid = valid;
    }

    public Customer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Customer customerId) {
        this.customerId = customerId;
    }

    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (checkid != null ? checkid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Checks)) {
            return false;
        }
        Checks other = (Checks) object;
        if ((this.checkid == null && other.checkid != null) || (this.checkid != null && !this.checkid.equals(other.checkid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Checks[ checkid=" + checkid + " ]";
    }
    
}
